Facbook Pixel

Testing Your Server for Open Relays

If your server has its mail relays open, your server might be used to send spam emails. If you're not sure if your relays are open, try both tests below. If your relays are open, you should use the instructions below to close them.

To Manually Test Your Server for Open Relays

From your local machine, run the following command through cmd (Windows®) or SSH (Mac and Linux):

telnet [server IP] 25
helo me
mail from: testfrom@coolexample.com
rcpt to: testrcpt@coolexample.com

Where [server IP] is your server's IP address.

If your relays are closed, you will receive an error that you cannot connect, similar to the following error:

Trying IP address...
Connected to mail.myserver.com.
Escape character is '^]'.
...
554 : Relay access denied

If you receive any other outputs, your relays are open.

To Perform an Automated Test for Open Relays

  1. Go to http://mxtoolbox.com/diagnostic.aspx.
  2. In the Mail Server field, enter your server's IP address.
  3. Click Test Email Server.

On the page that displays, receiving a message of Failed To Connect in the Results column of the SMTP Connect row means your relays are closed.

If you receive any other outputs, your relays are open.

To Close Open Relays

Click one of the following, based on your control panel:

Plesk

  1. Log in to Plesk as admin.
  2. Click Server, and then click Mail.
  3. For Relays, select either Closed or Authentication Required.
  4. Click OK.

cPanel

Servers using cPanel® have closed relays by default. If you think they might be open, you can close them.

  1. Connect to your server via SSH.
  2. Run the following commands:
    /scripts/fixrelayd
    /etc/rc.d/init.d/antirelayd restart
    service exim restart

Simple Control Panel

  1. Connect to your server via SSH.
  2. Using a text editor, add the following line to the bottom of /etc/postfix/main.cf:
    smtpd_sender_restrictions = reject_unknown_sender_domain,reject_non_fqdn_sender
  3. Run the following command:
    service postfix restart